Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next

What current scenario is

What I see is that the image extraction does not work for some set of documents. However, the same image does get extracted and saved correctly for another set of documents. No issues for that docs. Is there any possibility that the document where I am pasting these images are corrupted. If yes, is there any way to resolve this as my production data is just same like my development data.

If the images are corrupted is how can I figure that out and resolve that?

I have done error handling in my code, so that if even if there is any error the agent will continue from where the error was thrown.

Below is the code I'm running. Please let me know if you find any bugs or wrong usages in my code:

Option Public

Dim DraftDb As NotesDatabase
Dim ProdDb As NotesDatabase
Dim doc,doc1,olddoc As NotesDocument
Dim prodcode ,prodc,var,flag As Variant
Dim prodView As NotesView, draftView As NotesView
Dim dc As NotesDocumentCollection
Dim Server,Server1,dbName,dbName1,dbName2,dbName3,dbName4 As String
Dim temp1,temp2,temp3,temp4 As NotesRichTextItem
Dim FullString1,FullString2,FullString3,FullString,count As Variant
Dim workspace As NotesUIWorkspace

Sub Initialize
On Error GoTo ErrorHandler

Dim session As New NotesSession
Dim cnt As Integer
Server = "prd/well/pen/MY_NOTES"
Server1="dev/well/pen/MY_NOTES"

Set DraftDb=session.GetDatabase(Server1,"ProdSpec\MainDraft.nsf")
Set draftView=DraftDb.GetView("6. Reporting\MainDocs")

Set doc=draftView.GetFirstDocument
count=0
While Not doc Is Nothing


FullString =doc.CustSpecLogo(0)
If FullString <> "" Then
StartString = "HREF="
EndString = "/$file"
flag=1
tmp = StrRight(StrLeft(FullString, EndString), StartString)
fileName=StrRightBack(tmp,"/")
path=StrLeftBack(tmp,".nsf")
dbName=StrRightBack(path,"/")+".nsf"
dbName="ProdSpec\"+dbName

Set ProdDb = session.GetDatabase(Server,dbName)
Set prodView=ProdDb.GetView("LookupFiles")
Set doc1=prodView.Getdocumentbykey(fileName)

Dim rt As New NotesRichTextItem( doc, "CSLogo" )

Set temp = doc1.GetFirstItem( "Body" )
Call rt.AppendRTItem( temp )
Call doc.Save(True, False)



End if
'second field
first:
FullString1 =doc.ProdImage(0)
If FullString1 <> "" Then
StartString1 = "HREF="
EndString1 = "/$file"
flag=2
tmp1 = StrRight(StrLeft(FullString1, EndString1), StartString1)
fileName1=StrRightBack(tmp1,"/")
path1=StrLeftBack(tmp1,".nsf")
dbName1=StrRightBack(path1,"/")+".nsf"
dbName1="ProdSpec\"+dbName1

Set ProdDb = session.GetDatabase(Server,dbName1)
Set prodView=ProdDb.GetView("LookupFiles")
Set doc1=prodView.Getdocumentbykey(fileName1)

Dim rt1 As New NotesRichTextItem( doc, "ProdImg" )

Set temp1 = doc1.GetFirstItem( "Body" )
Call rt1.AppendRTItem( temp1 )
Call doc.Save(True, False)


End If
'third field
second1:
FullString2=doc.NutInfoImg(0)
If FullString2 <> "" Then
StartString2 = "HREF="
EndString2 = "/$file"
flag=3
tmp2 = StrRight(StrLeft(FullString2, EndString2), StartString2)
fileName2=StrRightBack(tmp2,"/")
path2=StrLeftBack(tmp2,".nsf")
dbName2=StrRightBack(path2,"/")+".nsf"
dbName2="ProdSpec\"+dbName2

Set ProdDb = session.GetDatabase(Server,dbName2)
Set prodView=ProdDb.GetView("LookupFiles")
Set doc1=prodView.Getdocumentbykey(fileName2)

Dim rt2 As New NotesRichTextItem( doc, "NutImg" )

Set temp2 = doc1.GetFirstItem( "Body" )
Call rt2.AppendRTItem( temp2 )
Call doc.Save(True, False)


End If

'forth field

third:
FullString3=doc.NutrLabel(0)
If FullString3 <> "" Then
StartString3 = "HREF="
EndString3 = "/$file"
flag=4
tmp3 = StrRight(StrLeft(FullString3, EndString3), StartString3)
fileName3=StrRightBack(tmp3,"/")
path3=StrLeftBack(tmp3,".nsf")
dbName3=StrRightBack(path3,"/")+".nsf"
dbName3="ProdSpec\"+dbName3

Set ProdDb = session.GetDatabase(Server,dbName3)
Set prodView=ProdDb.GetView("LookupFiles")
Set doc1=prodView.Getdocumentbykey(fileName3)

Dim rt3 As New NotesRichTextItem( doc, "Nutlab" )

Set temp3 = doc1.GetFirstItem( "Body" )
Call rt3.AppendRTItem( temp3 )
Call doc.Save(True, False)


End If

'fifth Field
forth:
FullString4 =doc.PrBoxEndLab(0)
If FullString4 <> "" Then
StartString4 = "HREF="
EndString4 = "/$file"
flag=5
tmp4 = StrRight(StrLeft(FullString4, EndString4), StartString4)

fileName4=StrRightBack(tmp4,"/")
path4=StrLeftBack(tmp4,".nsf")
dbName4=StrRightBack(path4,"/")+".nsf"
dbName4="ProdSpec\"+dbName4

Set ProdDb = session.GetDatabase(Server,dbName4)
Set prodView=ProdDb.GetView("LookupFiles")
Set doc1=prodView.Getdocumentbykey(fileName4)

Dim rt4 As New NotesRichTextItem( doc, "PrBoxImg" )

Set temp4 = doc1.GetFirstItem( "Body" )
Call rt4.AppendRTItem(temp4 )
Call doc.Save(True, False)


End If


Done:

Set doc=draftView.Getnextdocument(doc)
count=count+1
flag=0
Wend

draftView.Autoupdate=True
Call draftView.Refresh()
MsgBox "Step 1 Completed:Images pulled successfully" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Step 2: Use toolbar icon on top left corner of the screen to convert specs into PDF"

ErrorHandler:

Select Case flag

Case 1

Resume first

Case 2
Resume second1

Case 3
Resume third

Case 4
Resume forth

Case 5
Resume Done
End Select



End Sub

Thanks,
Suji M


Feedback response number WEBB9JXFJX created by ~Wendy Brekimarjip on 05/09/2014

Invalid or non existent document (~Wendy Brekimar... 8.May.14)
. . My first shot is... (~Joseph Desfooc... 8.May.14)
. . . . Large no. of docs (~Wendy Brekimar... 8.May.14)
. . . . . . RE: Large no. of docs (~Joseph Desfooc... 9.May.14)
. . add an error handler (~Phil Nonhipige... 8.May.14)
. . . . What current scenario is (~Wendy Brekimar... 9.May.14)
. . . . . . record where/how error occurred (~Phil Nonhipige... 9.May.14)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS